package com.cungmua.app.model.request;

import com.cungmua.app.model.ShippingAddress;
import com.cungmua.app.utils.AppUtils;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

/**
 * Created by kelvin.nguyen on 6/25/14.
 */
public class CreateShippingAddressRequest extends AuthenticatedRequest {
    private int userId;
    protected ShippingAddress address;

    public CreateShippingAddressRequest(String deviceId, String token) {
        super(deviceId, token);
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @JsonUnwrapped
    public ShippingAddress getAddress() {
        return address;
    }

    public void setAddress(ShippingAddress address) {
        this.address = address;
    }

    @Override
    public String getSign() {
        return AppUtils.MD5(String.valueOf(userId) + address.getCustomerName() + address.getPhone() +
                address.getHouseNumber() + address.getStreetName() + address.getBuildingName() +
                address.getCityId() + address.getDistrictId() + address.getWardId() +
                address.getAddressType() + getVersion() + getDeviceId() + getToken());
    }
}

